package com.sayice.design.Visitor;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Lei extends Entry{
    String name;
    List<Entry> list=new ArrayList<>();
    Lei(String name){
        this.name=name;
    }
    @Override
    public void accept(Visitor v) {
        v.visit(this);
    }

    @Override
    public String getName() {
        return this.name;
    }

    public Iterator iterator(){
        return list.iterator();
    }
    @Override
    public int amount() {
        int size=0;
        Iterator it= list.iterator();
        while(it.hasNext()){
            Entry e=(Entry)it.next();
            size+=e.amount();
        }
        return size;
    }
    public void add(Entry entry){
        list.add(entry);
    }
}
